-
-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor BaseRowItem to use inheritance #3598
Refactor BaseRowItem to use inheritance #3598
Conversation
app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/BaseItemDtoBaseRowItem.kt
Fixed
Show fixed
Hide fixed
app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/BaseItemDtoBaseRowItem.kt
Fixed
Show fixed
Hide fixed
This also cleans the constructor hell a bit (although still a mess)
6316535
to
8d04ff3
Compare
|
||
else -> when { | ||
baseItem?.criticRating != null -> when { | ||
baseItem.criticRating!! > 59f -> R.drawable.ic_rt_fresh |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
).joinToString(" - ") | ||
|
||
val timestamp = buildString { | ||
append(SimpleDateFormat("d MMM").format(TimeUtils.getDate(baseItem.startDate))) |
Check warning
Code scanning / Android Lint
Implied locale in date format Warning
|
||
open class BaseRowItem protected constructor( | ||
abstract class BaseRowItem protected constructor( |
Check warning
Code scanning / detekt
Always override hashCode when you override equals. All hash-based collections depend on objects meeting the equals-contract. Two equal objects must produce the same hashcode. When inheriting equals or hashcode, override the inherited and call the super method for clarification. Warning
app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/AudioQueueBaseRowItem.kt
Fixed
Show fixed
Hide fixed
mCounter.setText(((BaseRowItem) item).getIndex() + 1 + " | " + mQueueRow.getAdapter().size()); | ||
// Keep counter | ||
ItemRowAdapter adapter = (ItemRowAdapter) mQueueRow.getAdapter(); | ||
mCounter.setText((adapter.indexOf(item) + 1) + " | " + adapter.size()); |
Check warning
Code scanning / Android Lint
TextView Internationalization Warning
mCounter.setText(((BaseRowItem) item).getIndex() + 1 + " | " + mQueueRow.getAdapter().size()); | ||
// Keep counter | ||
ItemRowAdapter adapter = (ItemRowAdapter) mQueueRow.getAdapter(); | ||
mCounter.setText((adapter.indexOf(item) + 1) + " | " + adapter.size()); |
Check warning
Code scanning / Android Lint
TextView Internationalization Warning
@@ -68,12 +66,12 @@ | |||
} | |||
} | |||
|
|||
public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) { | |||
public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, final Context context) { |
Check notice
Code scanning / Android Lint
Unknown nullness Note
@@ -68,12 +66,12 @@ | |||
} | |||
} | |||
|
|||
public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) { | |||
public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, final Context context) { |
Check notice
Code scanning / Android Lint
Unknown nullness Note
@@ -68,12 +66,12 @@ | |||
} | |||
} | |||
|
|||
public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) { | |||
public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, final Context context) { |
Check notice
Code scanning / Android Lint
Unknown nullness Note
override fun getFullName(context: Context) = chapterInfo.name | ||
override fun getName(context: Context) = chapterInfo.name | ||
|
||
override fun getSubText(context: Context) = |
Check notice
Code scanning / Android Lint
Unknown nullness Note
@@ -44,7 +44,7 @@ | |||
mediaTypes = includeMediaTypes, | |||
) | |||
|
|||
return HomeFragmentBrowseRowDefRow(BrowseRowDef(title, query, 0, false, true, arrayOf(ChangeTriggerType.VideoQueueChange, ChangeTriggerType.TvPlayback, ChangeTriggerType.MoviePlayback))) | |||
return HomeFragmentBrowseRowDefRow(BrowseRowDef(title, query, 0, false, true, arrayOf(ChangeTriggerType.TvPlayback, ChangeTriggerType.MoviePlayback))) |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style. Warning
Changes
Issues